import akshare as ak
import matplotlib.pyplot as plt

#盈利预测：stock_profit_forecast
stock_prifit_forecast_df=ak.stock_profit_forecast()
stock_prifit_forecast_df.to_excel('盈利预测.xlsx')
fig,ax=plt.subplots(1,1)
line1,=ax.plot(stock_prifit_forecast_df['名称'],stock_prifit_forecast_df['2022预测每股收益'],'ro')
line2,=ax.plot(stock_prifit_forecast_df['名称'],stock_prifit_forecast_df['2024预测每股收益'],'bo')
#line2,=ax.plot(stock_prifit_forecast_df['名称'],stock_prifit_forecast_df['2023预测每股收益'],'bo')
ax.set_xticklabels(stock_prifit_forecast_df['名称'],rotation=90,fontsize='xx-small')
ax.set_title('盈利预期')
ax.legend([line1,line2],labels=['2022年收益','2024年收益'])
#ax.legend([line1],labels=['2022年收益'])
plt.rcParams['font.sans-serif']=['Arial Unicode MS']
plt.show()



stock_zh_a_minute_df = ak.stock_zh_a_minute(symbol='sh000300', period='1')
print(stock_zh_a_minute_df)
